package com.neusoft.elmboot.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.neusoft.elmboot.po.Wallet;

@Mapper
public interface WalletMapper {

	@Update("update wallet set balance=balance+#{balance} where userId=#{userId}")
	public int rechargeWallet(Wallet wallet);
	
	public int payoutWallet(Wallet wallet);
	
	@Insert("insert into wallet values(#{userId},0,1)")
	public int createWallet(Wallet wallet);
	
	@Select("select balance from wallet where userId=#{userId}")
	public double getBalanceById(String userId);
	
	@Update("update wallet set everpay=#{everpay},give=#{give},discount={discount}")
	public int setrules(double everpay,double give,double discount);
	
	@Select("select type from wallet where userId=#{userId}")
	public int getTypeById(String userId);
	
	@Update("update wallet set type=#{type} where userId=#{userId}")
	public int changeTypeById(Wallet wallet);
}